import pandas as pd
import os
from tqdm import tqdm

df_list = []

for file in tqdm(os.listdir('results'), desc='Reading files...'):
    if not file.endswith('.csv'): continue
    path = os.path.join('results', file)

    df_list.append(pd.read_csv(path, engine='c'))

print('Writing...')
pd.concat(df_list, ignore_index=True, sort=False)[['KPI ID', 'timestamp', 'predict']].to_csv('submit.csv', index=False)
